package com.itlong.cloud.property.dao;

import com.itlong.cloud.POJO.PO.TimeTaskPropertyCostStatisticsPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      运营报表业务处理数据访问接口
 * </desc>
 *
 * @createDate 2018/08/13
 */
@Mapper
@Repository
public interface IPropertyOperatingReportDao {
    /**
     * <desc>
     *      获取所有项目id
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    List<String> getProjects();

    /**
     * <desc>
     *      保存报表
     * </desc>
     *
     * @param params 数据参数
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    Integer save(Map<String,Object> params);

    /**
     * <desc>
     *      获取报表中的项目id
     * </desc>
     *
     * @createDate 2019/06/17
     * @author Jiaqi.X
     * @return
     */
    List<String> getStatisticsReportProjects();

    /**
     * <desc>
     *      统计每月的已缴报表数据
     * </desc>
     *
     * @param date
     * @param projectId
     * @param payment 1已缴费 0未缴费 2应缴
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    List<Map<String,Object>> statisticsPaymentForDay(@Param("date") String date,@Param("projectId") String projectId,@Param("payment") Integer payment);

    /**
     * <desc>
     *      统计每月的维修费数据
     * </desc>
     *
     * @param date
     * @param projectId
     * @param feeStatus 1未交费 2已缴费 3应缴费
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/25
     */
    List<Map<String,Object>> statisticsServiceFee(@Param("date") String date,@Param("projectId") String projectId,@Param("feeStatus") Integer feeStatus);



    /**
     * <desc>
     *      删除当月或当年的的统计数据
     * </desc>
     *
     * @param date
     * @param projectId
     * @param isYear 1月 2年
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    Integer deleteForMonth(@Param("date") String date,@Param("projectId") String projectId,@Param("isYear") Integer isYear);

    /**
     * <desc>
     *      统计当月或当年的账单数据
     * </desc>
     *
     * @param date
     * @param projectId
     * @param payment 1缴费 0欠费
     * @param isYear 1月 2年
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    TimeTaskPropertyCostStatisticsPO statisticsPaymentForMonth(@Param("date") String date,@Param("projectId") String projectId,
                                                               @Param("payment") Integer payment,@Param("isYear") Integer isYear);

    /**
     * <desc>
     *      根据时间条件查询报表统计数据
     * </desc>
     *
     * @param startTime
     * @param endTime
     * @param payment
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    Map<String,Object> getDataByMonth(@Param("startTime") String startTime,@Param("endTime") String endTime,
                                      @Param("payment") Integer payment,@Param("projectId") String projectId);

    /**
     * <desc>
     *      根据时间条件
     * </desc>
     *
     * @param startYear
     * @param endYear
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/08/13
     */
    Map<String,Object> getDataByYear(@Param("startYear") String startYear,@Param("endYear") String endYear,@Param("projectId") String projectId);

    /**
     * <desc>
     *      删除当月统计数据
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/16
     */
    Integer deleteForCurrentDay(@Param("projectId") String projectId);

    /**
     * <desc>
     *      获取项目下的账单数据最大日期及最小日期
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/24
     */
    Map<String,String> getProjectMaxMonthAndMinMonth(@Param("projectId") String projectId);

    /**
     * <desc>
     *      获取项目下的统计金额数据最大年份及最小年份
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/10/24
     */
    Map<String,String> getProjectMaxYearAndMinYear(@Param("projectId") String projectId);

    /**
     * <desc>
     *      根据项目id获取月份的统计数据
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/18
     */
    List<Map<String,Object>> getMonthListByProjectId(@Param("projectId") String projectId);

    /**
     * <desc>
     *      查询分润费
     * </desc>
     *
     * @param projectId
     * @param month
     * @return
     * @authro Jiaqi.X
     * @createDate 2019/06/18
     */
    String getShareMoneyByProjectIdAndMonth(@Param("projectId") String projectId,@Param("month") String month);

    /**
     * <desc>
     *      删除运营分析数据
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/18
     */
    Integer deleteAnalyData();
}
